package com.linx.common.translation.core.impl;

import com.linx.common.core.service.EnterpriseService;
import com.linx.common.translation.annotation.TranslationType;
import com.linx.common.translation.constant.TransConstant;
import com.linx.common.translation.core.TranslationInterface;
import lombok.AllArgsConstructor;

/**
 * 企业名称翻译实现类
 * @author linx
 * {@code @date} 2024/10/14
 */
@AllArgsConstructor
@TranslationType(type = TransConstant.ENTERPRISE_ID_TO_NAME)
public class EnterpriseNameTranslationImpl implements TranslationInterface<String> {

    private final EnterpriseService enterpriseService;

    @Override
    public String translation(Object key, Object key2, String other, Class<?> clazz) {
        if (key == null || key.toString().isEmpty()) {
            return null;
        }

        return enterpriseService.getEnterpriseNameById(key.toString());
    }
}
